package org.martin.snsrs.utils;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;

public class SessionUtils {
	public static String getUserSessionKey(){
		Map<String, Object> session = ActionContext.getContext().getSession();
		if(session.containsKey("sessionKey"))
			return (String)session.get("sessionKey");
		else {
			return null;
		}
	}
	
	public static void setUserSessionKey(String sessionKey){
		Map<String, Object> session = ActionContext.getContext().getSession();
		session.put("sessionKey", sessionKey);
	}
	
	public static Integer getUserID(){
		Map<String, Object> session = ActionContext.getContext().getSession();
		if(session.containsKey("userID"))
			return (Integer)session.get("userID");
		else {
			return null;
		}
	}
	
	public static void setUserID(int userID){
		Map<String, Object> session = ActionContext.getContext().getSession();
		session.put("userID", userID);
	}
}
